<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('出库流水列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>子表ID：</label>-->
<!--                                <input type="text" name="jobDetailId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>主表ID：</label>-->
<!--                                <input type="text" name="jobId"/>-->
<!--                            </li>-->
                            <li>
                                <label>仓库：</label>
                                <select id="warehouseId" name="warehouseId" style="width: 200px">
                                    <option value="01">托盘库</option>
                                    <option value="02">料箱库</option>
                                </select>
                            </li>
                            <li>
                                <label>任务号：</label>
                                <input type="text" name="taskNo"/>
                            </li>
<!--                            <li>-->
<!--                                <label>巷道：</label>-->
<!--                                <input type="text" name="roadwayId"/>-->
<!--                            </li>-->
                            <li>
                                <label>货位编码：</label>
                                <input type="text" name="cargoSpaceId"/>
                            </li>
                            <li>
                                <label>托盘条码：</label>
                                <input type="text" name="trayCode"/>
                            </li>
<!--                            <li>-->
<!--                                <label>暂存入库：</label>-->
<!--                                <input type="text" name="faultFlag"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>执行阶段：</label>-->
<!--                                <input type="text" name="executionPhase"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>优先级：</label>-->
<!--                                <input type="text" name="priority"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>作业类型：</label>-->
<!--                                <select name="inOrOut" th:with="type=${@dict.getType('in_or_out')}">-->
<!--                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"-->
<!--                                            th:value="${dict.dictValue}"></option>-->
<!--                                </select>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>开始时间：</label>-->
<!--                                <input type="text" name="startTime"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>完成时间：</label>-->
<!--                                <input type="text" name="finishTime"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>库存编码：</label>-->
<!--                                <input type="text" name="stockId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>批号：</label>-->
<!--                                <input type="text" name="lotNo"/>-->
<!--                            </li>-->
                            <li>
                                <label>出库主单：</label>
                                <input type="text" name="inOrOutId"/>
                            </li>
                            <li>
                                <label>出库子单：</label>
                                <input type="text" name="inOrOutDId"/>
                            </li>
                            <li>
                                <label>物资编码：</label>
                                <input type="text" name="productId"/>
                            </li>
<!--                            <li>-->
<!--                                <label>出库数量：</label>-->
<!--                                <input type="text" name="outQuantity"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>生产时间：</label>-->
<!--                                <input type="text" name="printDate"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>客户编码：</label>-->
<!--                                <input type="text" name="grade"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>供应商：</label>-->
<!--                                <input type="text" name="spec"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>物资名称：</label>-->
<!--                                <input type="text" name="productName"/>-->
<!--                            </li>-->
                            <li>
                                <label>创建时间：</label><input type="text" placeholder="请单击选择开始时间：" autocomplete="off"
                                                           name="startTime" id="startTime"/>---
                                <input type="text" placeholder="请单击选择结束时间：" autocomplete="off" name="finishTime"
                                       id="finishTime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="search:viewOutJobHistory:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="search:viewOutJobHistory:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="search:viewOutJobHistory:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()"  >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('search:viewOutJobHistory:edit')}]];
        var removeFlag = [[${@permission.hasPermi('search:viewOutJobHistory:remove')}]];
        var prefix = ctx + "search/viewOutJobHistory";
        var jobStatus = [[${@dict.getType('job_status')}]];
        var executionPhase= [[${@dict.getType('execution_phase')}]];
        var outJob= [[${@dict.getType('outjob')}]];
        var warehouseId = [[${@dict.getType('is_house')}]];
        var productStatus = [[${@dict.getType('product_status')}]];

        layui.use('laydate', function () {
            var laydates = layui.laydate;
            laydates.render({
                elem: '#startTime'
                , type: 'datetime',
                /* ,range: '到' */
                format: 'yyyy-MM-dd HH:mm:ss'
            })
        })

        layui.use('laydate', function () {
            var laydates = layui.laydate;
            laydates.render({
                elem: '#finishTime'
                , type: 'datetime',
                /* ,range: '到' */
                format: 'yyyy-MM-dd HH:mm:ss'
            })
        })

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "出库流水",
                clickToSelect: true,//是否启用点击选中行
                uniqueId:"jobDetailId",//表主键(用于修改和删除)
                sortName:"jobDetailId",//必加排序 sortOrder: "asc"默认
                columns: [
                    {
                        halign: 'center',
                        align:'center',
                        checkbox: true
                    },
                {
                    title: "序号",
                    halign: 'center',
                    align:'center',
                    width: 55,
                    formatter:function (value, row, index) {
                        //获取每页显示的数量
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                        //获取当前是第几页
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                        //返回序号，注意index是从0开始的，所以要加上1
                        return pageSize * (pageNumber - 1) + index + 1;

                    }
                },

                {
                    field: 'jobDetailId',
                    title: '子表ID',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'jobId',
                    title: '主表ID',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'status',
                    title: '状态',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(jobStatus, value);
                    }
                },
                {
                    field: 'taskNo',
                    title: '任务号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'roadwayId',
                    title: '巷道',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'cargoSpaceId',
                    title: '货位编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'trayCode',
                    title: '托盘条码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                 {
                     field: 'productName',
                     title: '物资名称',
                     halign: 'center',
                     align:'center',
                     sortable: true,
                     visible: true
                 },
                {
                    field: 'faultFlag',
                    title: '暂存入库',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'cargoSpaceName',
                    title: '货位',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                /*{
                    field: 'executionPhase',
                    title: '执行阶段',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(executionPhase, value);
                    }
                },*/
               /* {
                    field: 'priority',
                    title: '优先级',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: false
                },*/
               /* {
                    field: 'inOrOut',
                    title: '作业类型',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(outJob, value);
                    }
                },*/
                {
                    field: 'startTime',
                    title: '开始时间',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'finishTime',
                    title: '完成时间',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'warehouseId',
                    title: '仓库',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(warehouseId, value);
                    }
                },
                {
                    field: 'stockId',
                    title: '库存编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'lotNo',
                    title: '批号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'inOrOutId',
                    title: '出入库主单据编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'inOrOutDId',
                    title: '出入库子单据编号',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productId',
                    title: '物资编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'outQuantity',
                    title: '出库数量',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'grade',
                    title: '客户编码',
                    halign: 'center',
                    align:'center',
                    sortable: true,
                    visible: true
                }
                ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>